#pragma once
#include <vector>

//
class DataConstant
{
public:
    /**
     * @brief 计算各个天体数据的需要参与计算的大小;
     *
     * @param arraySize
     *                天体各数据大小;
     * @param CalcItemsCount
     *                 指定参与计算的次数;
     * @return std::vector<int> 实际个数据参加计算的次数;
     */
    static std::vector<int> CalcIndexValue(std::vector<int> arraySize, const int entrysize, int CalcItemsCount)
    {
        double firstSize = arraySize[0] * entrysize;

        std::vector<int> result;

        // 全部;
        if (CalcItemsCount < 0)
            CalcItemsCount = firstSize;

        for (int i = 0; i < arraySize.size(); i++)
        {
            int itemCount = arraySize[i] * entrysize;
            // 按比例计算各项具体数值;
            double Count  = floor((CalcItemsCount * entrysize * itemCount) / firstSize + 0.5);
            // 具体循环数;
            if (i != 0)
                Count += entrysize;
            if (Count >= itemCount)
                Count = itemCount;
            // std::cout << firstSize << "-" << itemCount << "*" <<std::setprecision(5) << Count << "/";
            Count = ceil(Count / entrysize);
            // std::cout << Count << std::endl;
            result.push_back(Count);
        }
        return result;
    }
};